/*
 * @file emotion_handler.h
 *
 * @brief handle incoming emotion messages.
 * @author Michiel
 * @author Peter
 *
 * @date Nov 26, 2012
 */


// TODO Lol fix this shit. Definitions in headers.

#ifndef EMOTIONHANDLER_H_
#define EMOTIONHANDLER_H_

#include <ros/ros.h>

#include "topic/topic.h"
#include "comm/emotion_msg.h"

class EmotionHandler {
	private:
		bool _state;
		int _emotion;

		void emotionCallback(const comm::emotion::ConstPtr &message);
	protected:
		ros::NodeHandle nh_;
		ros::Subscriber emotion_sub_;
	public:
		EmotionHandler() : nh_("")
		{
			_state = false;
			_emotion = EMOTION_HAPPY;
			emotion_sub_ = nh_.subscribe(Topic::EMO_STATE, 1, &EmotionHandler::emotionCallback, this);
		}

		virtual ~EmotionHandler()
		{
			nh_.shutdown();
		}


		/**
		 * Return the state.
		 */
		bool emoteOk();

		/**
		 * Return the emotion.
		 */
		int getEmotion();
};

#endif /* EMOTIONHANDLER_H_ */
